{switch name="field.type"}
    {case text}
        <input class="form-control" type="text" name="{$field.name}" value="{$field.value|htmlspecialchars}" id="{$field.name}" placeholder="请填写{$field.title}">
    {/case}
    {case label}
        <div class="form-control">{$field.value}</div>
    {/case}
    {case hidden}
        <input type="hidden" name="{$field.name}" value="{$field.value}" id="{$field.name}" class="text input-large"/>
    {/case}
    {case readonly}
        <input type="text" name="{$field.name}" value="{$field.value}" id="{$field.name}" class="text input-large form-control" placeholder='' readonly/>
    {/case}
    {case integer}
        <input type="number" pattern="[0-9]*"  name="{$field.name}" value="{$field.value}"  id="{$field.name}" class="text input-large form-control"  />
    {/case}
    {case text|password}
        <input type="{$field.type}" name="{$field.name}" value="{$field.value??''}" class="form-control">
    {/case}
    {case textarea}
        <textarea name="{$field.name}" rows="5" class="form-control">{$field.value??''}</textarea>
    {/case}
    {case radio|radiov}
        {volist name="field.opt" id="option"}
            {if $field.type=='radiov'}
                <div class="radio i-checks">
                    <label for="id_{$field.name}_{$key}">
                        <input type="radio" name="{$field.name}" value="{$key}" id="id_{$field.name}_{$key}" {if $field.value==$key}checked{/if}/>
                        {$option}
                    </label>
                </div>
            {else/}
                <label for="id_{$field.name}_{$key}">
                    <input id="id_{$field.name}_{$key}" name="{$field.name}" value="{$key}" type="radio" {if $field.value==$key}checked{/if}/>
                    {$option}
                </label> &nbsp; &nbsp; &nbsp;
            {/if}
        {/volist}
    {/case}
    {case checkbox|checkboxv}
        <input type="hidden" name="{$field.name}" value="{$field.value}" class="checkbox-hidden" data-field-name="{$field.name}"/>
        <?php $field['value_array'] = explode(',', $field['value']);?>
        {volist name="field.opt" id="option"}
            {if $field.type=='checkboxv'}
                <div class="checkbox i-checks">
                    <label for="id_{$field.name}_{$key}">
                        <input type="checkbox" value="{$key}" class="checkbox" id="id_{$field.name}_{$key}"
                            data-field-name="{$field.name}" {if in_array($key, $field.value_array)}checked{/if} />
                        <i></i> {$option}
                    </label>
                </div>
            {else/}
                <label for="id_{$field.name}_{$key}">
                <input type="checkbox" value="{$key}" id="id_{$field.name}_{$key}"
                    class="oneplus-checkbox" data-field-name="{$field.name}" {if in_array($key, $field.value_array)}checked{/if} />
                    {$option}</label>
            {/if}
        {/volist}
    {/case}
    {case select}
        <select name="{$field.name}" class="form-control">
            {volist name="field.opt" id="option"}
                <option value="{$key}" {if $field.value==$key}selected{/if}>{$option}</option>
            {/volist}
        </select>
    {/case}
    {case date|datetime}
        <input type="text" name="{$field.name}" value="{$field.value??''}" onclick="laydate({if $field.type=='datetime'}{istime: true, format: 'YYYY-MM-DD hh:mm:ss'}{/if});" class="form-control layer-date filter" placeholder="请选择{$field.title}">
    {/case}
    {case chosen}
        {volist name="field.opt" id="option"}
            <label for="id_{$field.name}_{$key}">
                <input id="id_{$field.name}_{$key}" name="{$field.name}" value="{$key}" type="radio" {if $field.value==$key}checked{/if}/>
                {$option}
            </label> &nbsp; &nbsp; &nbsp;
        {/volist}
    {/case}
    {case select2}
        <select name="{$field.name}[]" class="select2" multiple data-placeholder="请选择{$field.title}" style="width: 100%;" tabindex="-1" aria-hidden="true">
            <?php
                if ( !isset($field['value']) || empty($field['value']) ) {
                    $field['value'] = [];
                } elseif ( is_string($field['value']) ) {
                    $field['value'] = explode(',', $field['value']);
                }
            ?>
            <?php if ( key($field['opt']) === 0 ) { ?>
                {volist name="field.opt" id="option"}
                    <option value="{:reset($option)}" <?php echo in_array(reset($option), $field['value']) ? 'selected':'';?>>{$option|end|htmlspecialchars}</option>
                {/volist}
            <?php } else { ?>
                <?php foreach ( $field['opt'] as $optgroupkey => $optgroup ) { ?>
                    <optgroup label="{$optgroupkey}">
                        {volist name="optgroup" id="option"}
                            <option value="{:reset($option)}" <?php in_array(reset($option),$field['value'])? 'selected':'';?>>{$option|end|htmlspecialchars}</option>
                        {/volist}
                    </optgroup>
                <?php } ?>
            <?php } ?>
        </select>
        <script type="text/javascript">
            $(function(){
                $(".select2").select2();
            });
        </script>
    {/case}

    {case editor}<!-- 富文本编辑器 -->
        {:widget('common/Ueditor/editor', array(
           $field['name'],
           $field['name'],
           $field['value'],
           $field['style']['width'],
           $field['style']['height'],
           $field['config']
        ))}
    {/case}
    {case file}<!-- 文件 -->
        {:widget('common/UploadFile/render', array(array(
            'name' =>$field['name'],
            'value' =>$field['value'],
        )))}
    {/case}
    {case multiFile}<!-- 多文件 -->
        {:widget('common/UploadMultiFile/render', array(array(
            'name' =>$field['name'],
            'limit' => 9,
            'value' =>$field['value'],
        )))}
    {/case}
    {case image}<!-- 图片 -->
        {:widget('common/UploadImage/render', array(array(
            'name' =>$field['name'],
            'value' =>$field['value'],
            'width' => 100,
            'height' => 100,
        )))}
    {/case}
    {case multiImage}<!-- 多图片 -->
        {:widget('common/UploadMultiImage/render', array(array(
            'name' =>$field['name'],
            'value' =>$field['value'],
            'width' => 100,
            'height' => 100,
        )))}
    {/case}
{/switch}